/*****************************************************************************
State of Aadhaar Survey 2017-2018

Title: 1_Enrolment_pub.do
Author: IDinsight
Contact: stateofaadhaar@idinsight.org
Date: 29 August 2018
Data: "SOA2018_nonroster_cleaned_gen.dta", "SOA2018_roster_cleaned_gen.dta"
User-written commands: estout (ssc install estout if not installed)
Description: 	This .do file conducts analysis for the Enrolment section and
				produces output tables in "1_Enrolment.rtf".

Contents:
	
	1. Analysis using non roster data
		- Survey set up
		- Tabulations / Proportions / Means
		- Regressions / Hypothesis tests
		
	2. Analysis using roster data
		- Survey set up
		- Tabulations / Proportions / Means
		- Regressions / Hypothesis tests
		- Additional analysis
	
Missing data code:
	.r = refused
	.d = don't know		
*****************************************************************************/

	
* Setting up
	
	version 14
	capture log close
	clear all
	mac drop _all
	set more off
	
	* Please replace "..." below with the correct file path on your computer
	if "`c(os)'"=="MacOSX"{
		global dir "/Users/`c(username)'/.../SOA2018_data_release/"
		}
	else{
		global dir "C:/Users/`c(username)'/.../SOA2018_data_release/"
		}

		
/*****************************************************************************
1. Analysis using non roster data
*****************************************************************************/

	*** Survey set up

		cd "${dir}/Data_sets/"
		use "SOA2018_nonroster_cleaned_gen.dta", clear

		drop hh_id
		rename master_key hh_id 
		svyset district_id [pweight=weight_resp_adj] || AC_id || ps_id || hh_id || _n
		cd "${dir}/Output_tables/"
		

	***  Tabulations / Proportions / Means
				
		*****************************************************************************
		* 6	Did you enrol for your Aadhaar at an Aadhaar camp? aadhaar_camp
		*****************************************************************************
		
			eststo clear
			eststo: estpost svy: tab aadhaar_camp, percent nototal ci
			estadd matrix cil = e(lb)
			estadd matrix ciu = e(ub)
			count if (aadhaar_camp ==.d | aadhaar_camp ==.r)
			estadd scalar missing  = r(N)
			count if (aadhaar_camp ==.e) 
			estadd scalar er  = r(N)
				forvalues i = 1/3 {
			display `i' 
			eststo: estpost svy: tab aadhaar_camp if state == `i', percent nototal ci
			estadd matrix cil = e(lb)
			estadd matrix ciu = e(ub)
			count if (aadhaar_camp ==.d | aadhaar_camp ==.r) & state == `i'
			estadd scalar missing  = r(N)
			count if (aadhaar_camp ==.e) & state == `i'
			estadd scalar er  = r(N)
				}
			
			esttab using "1_Enrolment.rtf", ///
			compress ///
			collabels(none) ///
			eqlabels(none) ///
			label ///
			modelwidth(0) ///
			incelldelimiter(-) ///
			cells(b(fmt(1)) "cil & ciu") ///
			title ("Table 1.1 Percentage of respondents who enrolled at a camp (among those who have an Aadhaar)") ///	
			nostar ///
			nonumbers ///
			mtitles ("All three states" "Andhra Pradesh" "Rajasthan" "West Bengal") ///
			nogaps ///
			stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know / refused)" "Number of observations with survey errors (hence missing)")) ///
			nonotes ///
			addnotes("Notes: 95% confidence intervals are under point estimates.") ///
			replace 
			
			eststo clear
		
		*****************************************************************************
		* 7	When you applied for an Aadhaar card, did you have this identity document: ___?
		*****************************************************************************
		
			eststo clear
			local IDs ad_enid_1 ad_enid_2 ad_enid_3 additionalID 
				
			* Pooled
				
				foreach var in `IDs' {
					eststo: estpost svy: tab `var', percent nototal ci
					estadd matrix cil = e(lb)
					estadd matrix ciu = e(ub)
					count if (`var' ==.d | `var' ==.r)
					estadd scalar missing  = r(N)
					count if (`var' ==.e)
					estadd scalar er  = r(N)
					}
				
				esttab using "1_Enrolment.rtf", ///
					collabels(none) ///
					eqlabels(none) ///
					label ///
					modelwidth(0) ///
					incelldelimiter(-) ///
					cells(b(fmt(1)) "cil & ciu") ///
					title ("Table 1.2.1 Percentage of respondents who had other forms of ID at the time of Aadhaar enrolment (among those who have an Aadhaar by ID type) [All three states]") ///
					nostar ///
					nonumbers ///
					mtitles ("NREGA job card" "Ration card" "Voter ID card" "Additional ID" ) ///
					nogaps ///
					stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know / refused)" "Number of observations with survey errors (hence missing)")) ///
					nonotes ///
					addnotes("Notes: 95% confidence intervals are under point estimates.") ///
					append
					eststo clear
					
			* By state
				
				tokenize `" "Andhra Pradesh" "Rajasthan" "West Bengal" "'
				forv i = 1/3 {
				foreach var in `IDs' {
					display `i' 
					eststo: estpost svy: tab `var' if state == `i', percent nototal ci
					estadd matrix cil = e(lb)
					estadd matrix ciu = e(ub)
					count if (`var' ==.d | `var' ==.r) & state == `i'
					estadd scalar missing  = r(N)
					count if (`var' ==.e) & state == `i'
					estadd scalar er  = r(N)
					}
				local k = `i' + 1
					
				esttab using "1_Enrolment.rtf", ///
					collabels(none) ///
					eqlabels(none) ///
					label ///
					modelwidth(0) ///
					incelldelimiter(-) ///
					cells(b(fmt(1)) "cil & ciu") ///
					title ("Table 1.2.`k' Percentage of respondents who had other forms of ID at the time of Aadhaar enrolment (among those who have an Aadhaar) [State: ``i++'']") ///
					nostar ///
					nonumbers ///
					mtitles ("NREGA job card" "Ration card" "Voter ID card" "Additional ID" ) ///
					nogaps ///
					stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know / refused)" "Number of observations with survey errors (hence missing)")) ///
					nonotes ///
					addnotes("Notes: 95% confidence intervals are under point estimates.") ///
					append
					eststo clear
				}	
			
		*****************************************************************************
		* 8. When you applied for an Aadhaar card, did you any form of identity document?
		*****************************************************************************
			
			eststo: estpost svy: tab ad_enid_10, percent nototal ci
			estadd matrix cil = e(lb)
			estadd matrix ciu = e(ub)
			count if (ad_enid_10 ==.d | ad_enid_10 ==.r)
			estadd scalar missing  = r(N)
			count if (ad_enid_10 ==.e) 
			estadd scalar er  = r(N)
				forvalues i = 1/3 {
			display `i' 
			eststo: estpost svy: tab ad_enid_10 if state == `i', percent nototal ci
			estadd matrix cil = e(lb)
			estadd matrix ciu = e(ub)
			count if (ad_enid_10 ==.d | ad_enid_10 ==.r) & state == `i'
			estadd scalar missing  = r(N)
			count if (ad_enid_10 ==.e) & state == `i'
			estadd scalar er  = r(N)
				}

			esttab using "1_Enrolment.rtf", ///
			compress ///
			collabels(none) ///
			eqlabels(none) ///
			label ///
			modelwidth(0) ///
			incelldelimiter(-) ///
			cells(b(fmt(1)) "cil & ciu") ///
			title ("Table 1.3 Percentage of respondents who had no other form of ID at the time of Aadhaar enrolment (among those who have an Aadhaar by State)") ///	
			nostar ///
			nonumbers ///
			mtitles ("All three states" "Andhra Pradesh" "Rajasthan" "West Bengal") ///
			nogaps ///
			stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know / refused)" "Number of observations with survey errors (hence missing)")) ///
			nonotes ///
			addnotes("Notes: 95% confidence intervals are under point estimates.") ///
			append 
			
			eststo clear
		
		
		*****************************************************************************
		* 9 Why did you get an Aadhaar card?
		*****************************************************************************
			eststo clear
			local IDs aadhaarwhy_1 aadhaarwhy_2 aadhaarwhy_3 aadhaarwhy_4 aadhaarwhy_5
				
			* Pooled
				
				foreach var in `IDs' {
					eststo: estpost svy: tab `var', percent nototal ci
					estadd matrix cil = e(lb)
					estadd matrix ciu = e(ub)
					count if (`var' ==.m | `var' ==.d) 
					estadd scalar missing  = r(N)
					count if (`var' ==.e) 
					estadd scalar er  = r(N)
					}
				
				esttab using "1_Enrolment.rtf", ///
					collabels(none) ///
					eqlabels(none) ///
					label ///
					modelwidth(0) ///
					incelldelimiter(-) ///
					cells(b(fmt(1)) "cil & ciu") ///
					title ("Table 1.4.1 Reasons for getting Aadhaar (among those who have an Aadhaar; numbers in percentage) [All three states]") ///
					nostar ///
					nonumbers ///
					mtitles ("Government/external impetus" "Access impetus" "Social network impetus" "Identity document impetus" "Other/no impetus" ) ///
					nogaps ///
					stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know / refused)" "Number of observations with survey errors (hence missing)")) ///
					nonotes ///
					addnotes("Notes: 95% confidence intervals are under point estimate."	///
					"Respondents could state multiple reasons in the corresponding survey question. We categorize the responses in the following way:"	///
					"Government/external impetus refers to cases where respondents say one of their reasons for getting Aadhaar is that Panchayat/Aadhaar/Government persons or other external agency told them to get one."	///
					"Access impetus refers to cases where respondents say one of their reasons for getting Aadhaar is that they need it to access government service(s), or private services like bank accounts and SIM cards."	///
					"Social network impetus refers to cases where respondents say one of their reasons for getting Aadhaar is that everyone was getting one or their family member told them to get one."	///
					"Identity document impetus refers to cases where respondents say one of their reasons for getting Aadhaar is that they wanted to use it as an identification document, they did not have an identification document, or they needed it to rectify other government/ID documents.")	///
					append
					eststo clear
				
				
			* By state
				
				tokenize `" "Andhra Pradesh" "Rajasthan" "West Bengal" "'
				forv i = 1/3 {
				foreach var in `IDs' {
					display `i' 
					eststo: estpost svy: tab `var' if state == `i', percent nototal ci
					estadd matrix cil = e(lb)
					estadd matrix ciu = e(ub)
					count if (`var' ==.m | `var' ==.d) & state == `i'
					estadd scalar missing  = r(N)
					count if (`var' ==.e)  & state == `i'
					estadd scalar er  = r(N)
					}
				local k = `i' + 1
				
				esttab using "1_Enrolment.rtf", ///
					collabels(none) ///
					eqlabels(none) ///
					label ///
					modelwidth(0) ///
					incelldelimiter(-) ///
					cells(b(fmt(1)) "cil & ciu") ///
					title ("Table 1.4.`k' Reasons for getting Aadhaar (among those who have an Aadhaar; numbers in percentage) [State: ``i++'']") ///
					nostar ///
					nonumbers ///
					mtitles ("Government/external impetus" "Access impetus" "Social network impetus" "Identity document impetus" "Other/no impetus" ) ///
					nogaps ///
					stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know / refused)" "Number of observations with survey errors (hence missing)")) ///
					nonotes ///
					addnotes("Notes: 95% confidence intervals are under point estimate."	///
					"See footnote to Table 1.4.1 for the definition of each impetus.")	///
					append
					eststo clear
				}	
			
			
		*****************************************************************************
		* 10 Did you pay anyone in the process of enrolling in Aadhaar?
		*****************************************************************************
			
			eststo: estpost svy: tab ad_pay, percent nototal ci
			estadd matrix cil = e(lb)
			estadd matrix ciu = e(ub)
			count if (ad_pay ==.d | ad_pay ==.r)
			estadd scalar missing  = r(N)
			count if (ad_pay ==.e) 
			estadd scalar er  = r(N)
				forvalues i = 1/3 {
			display `i' 
			eststo: estpost svy: tab ad_pay if state == `i', percent nototal ci
			estadd matrix cil = e(lb)
			estadd matrix ciu = e(ub)
			count if (ad_pay ==.d | ad_pay ==.r) & state == `i'
			estadd scalar missing  = r(N)
			count if (ad_pay ==.e) & state == `i'
			estadd scalar er  = r(N)
				}

			esttab using "1_Enrolment.rtf", ///
			compress ///
			collabels(none) ///
			eqlabels(none) ///
			label ///
			modelwidth(0) ///
			incelldelimiter(-) ///
			cells(b(fmt(1)) "cil & ciu") ///
			title ("Table 1.5 Percentage of respondents who paid to enrol for Aadhaar (among those who have an Aadhaar)") ///	
			nostar ///
			nonumbers ///
			mtitles ("All three states" "Andhra Pradesh" "Rajasthan" "West Bengal") ///
			nogaps ///
			stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know / refused)" "Number of observations with survey errors (hence missing)")) ///
			nonotes ///
			addnotes("Notes: 95% confidence intervals are under point estimates.") ///
			append 
			
			eststo clear
		
		*****************************************************************************
		* 11 For those who paid for enrolment: In total, how much did you have to pay to get your Aadhaar card?
		*****************************************************************************
			
			eststo: estpost svy: tab payscale, percent nototal ci
			estadd matrix cil = e(lb)
			estadd matrix ciu = e(ub)
			count if (payscale ==.d | payscale ==.r)
			estadd scalar missing  = r(N)
			count if (payscale ==.e) 
			estadd scalar er  = r(N)
				forvalues i = 1/3 {
			display `i' 
			eststo: estpost svy: tab payscale if state == `i', percent nototal ci
			estadd matrix cil = e(lb)
			estadd matrix ciu = e(ub)
			count if (payscale ==.d | payscale ==.r) & state == `i'
			estadd scalar missing  = r(N)
			count if (payscale ==.e) & state == `i'
			estadd scalar er  = r(N)
				}

			esttab using "1_Enrolment.rtf", ///
			compress ///
			collabels(none) ///
			coeflabels (_prop_1 "Less than 50" _prop_2 "50 to 200" _prop_3 "Above 200") ///
			eqlabels(none) ///
			label ///
			modelwidth(0) ///
			incelldelimiter(-) ///
			cells(b(fmt(1)) "cil & ciu") ///
			title ("Table 1.6 Amount paid for Aadhaar enrolment, in Rupees (among respondents who paid to enrol for Aadhaar; numbers in percentage)") ///	
			nostar ///
			nonumbers ///
			mtitles ("All three states" "Andhra Pradesh" "Rajasthan" "West Bengal") ///
			nogaps ///
			stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know / refused)" "Number of observations with survey errors (hence missing)")) ///
			nonotes ///
			addnotes("Notes: 95% confidence intervals are under point estimates.") ///
			append 
			
			eststo clear
			
		*****************************************************************************
		* 12 Aware of free enrolment?
		* Types of analysis: Proportion ad_pay 
		*****************************************************************************
		
			eststo: estpost svy: tab ad_freeaware, percent nototal ci
			estadd matrix cil = e(lb)
			estadd matrix ciu = e(ub)
			count if (ad_freeaware ==.d | ad_freeaware ==.r)
			estadd scalar missing  = r(N)
			count if (ad_freeaware ==.e) 
			estadd scalar er  = r(N)
				forvalues i = 1/3 {
			display `i' 
			eststo: estpost svy: tab ad_freeaware if state == `i', percent nototal ci
			estadd matrix cil = e(lb)
			estadd matrix ciu = e(ub)
			count if (ad_freeaware ==.d | ad_freeaware ==.r) & state == `i'
			estadd scalar missing  = r(N)
			count if (ad_freeaware ==.e) & state == `i'
			estadd scalar er  = r(N)
				}

			esttab using "1_Enrolment.rtf", ///
			compress ///
			collabels(none) ///
			eqlabels(none) ///
			label ///
			modelwidth(0) ///
			incelldelimiter(-) ///
			cells(b(fmt(1)) "cil & ciu") ///
			title ("Table 1.7 Percentage of respondents who are aware that Aadhaar enrolment is free (among those who have an Aadhaar)") ///	
			nostar ///
			nonumbers ///
			mtitles ("All three states" "Andhra Pradesh" "Rajasthan" "West Bengal") ///
			nogaps ///
			stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know / refused)" "Number of observations with survey errors (hence missing)")) ///
			nonotes ///
			addnotes("Notes: 95% confidence intervals are under point estimates.") ///
			append 
			
			eststo clear
			
			
		*****************************************************************************
		* 13 Overall ease of enrolment
		* Types of analysis: Proportion ad_pay 
		*****************************************************************************
		
		
			eststo: estpost svy: tab ad_enease, percent nototal ci
			estadd matrix cil = e(lb)
			estadd matrix ciu = e(ub)
			count if (ad_enease ==.d | ad_enease ==.r)
			estadd scalar missing  = r(N)
			count if (ad_enease ==.e) 
			estadd scalar er  = r(N)
				forvalues i = 1/3 {
			display `i' 
			eststo: estpost svy: tab ad_enease if state == `i', percent nototal ci
			estadd matrix cil = e(lb)
			estadd matrix ciu = e(ub)
			count if (ad_enease ==.d | ad_enease ==.r) & state == `i'
			estadd scalar missing  = r(N)
			count if (ad_enease ==.e) & state == `i'
			estadd scalar er  = r(N)
				}

			esttab using "1_Enrolment.rtf", ///
			compress ///
			collabels(none) ///
			eqlabels(none) ///
			label ///
			modelwidth(0) ///
			incelldelimiter(-) ///
			cells(b(fmt(1)) "cil & ciu") ///
			title ("Table 1.8 Perceived ease of the Aadhaar enrolment process (among respondents who have an Aadhaar)") ///	
			nostar ///
			nonumbers ///
			mtitles ("All three states" "Andhra Pradesh" "Rajasthan" "West Bengal") ///
			nogaps ///
			stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know / refused)" "Number of observations with survey errors (hence missing)")) ///
			nonotes ///
			addnotes("Notes: 95% confidence intervals are under point estimates."	///
			"Respondents were asked: 'Overall, how easy or difficult did you find the process of getting your Aadhaar card?' and were given the options of 'Easy', 'Neutral' and 'Difficult' to choose from.") ///
			append 
			
			eststo clear
			
			
			
	***  Regressions / Hypothesis tests
	
	
		*********************************************
		** Payment by demographics and camp **	
		*********************************************	
			replace ad_payrs = 0 if ad_pay == 0
		
			* Pooled
			
				loc option append
				eststo clear
				local regressors `" "sc_cat st_cat" rel_muslim resp_noschool resp_female resp_above60 aadhaar_camp"' 
				foreach var in `regressors'{
					qui svy: regress ad_pay `var'
					gen sample = e(sample)
					count if (ad_pay ==.d | ad_pay ==.r)
					loc miss = r(N)
					count if (ad_pay ==.e)
					loc errors = r(N)
					
					preserve
					keep if sample == 1
					svy: mean ad_pay
					loc y1 = _b[ad_pay]
					eststo: svy: regress ad_pay `var'
					estadd scalar missing = `miss'
					estadd scalar errors = `errors'
					estadd scalar y = `y1'
					restore
					drop sample
				}
				esttab using "1_Enrolment.rtf", ///
					compress ///
					eqlabels(none) ///
					label ///
					title ("Table 1.9.1 Hypothesis tests of differences in the likelihood of paying for enrolment among respondents from different vulnerable communities, and whether respondent enrolled at a camp [All three states]") ///	
					coeflabels (sc_cat "SC respondent" st_cat "ST respondent" rel_muslim "Muslim respondent" resp_noschool  "Respondent has not attended school" resp_female "Female respondent" resp_above60 "Respondent above age 60") ///
					mtitles("Having paid for enrolment" "Having paid for enrolment" "Having paid for enrolment" "Having paid for enrolment" "Having paid for enrolment" "Having paid for enrolment" "Having paid for enrolment" "Having paid for enrolment") ///
					p ///
					star (* 0.1 ** 0.05 *** 0.01) ///
					lines ///
					b (3) ///
					p (2) ///
					nogaps ///
					stats(N r2 y, fmt(0 3 3) label("Number of observations" "R-squared" "Mean of dependent variable")) ///
					nonotes ///
					addnotes("Notes: p-values in parentheses, with ***, **, * indicating significance at 1, 5 and 10%. No correction for multiple hypothesis testing has been applied to the results in the table." ///
					"We test the null hypotheses that there are no differences in the likelihood of paying for enrolment between vulnerable respondents and other respondents, with vulnerability being proxied by each of the categories above. Each column presents coefficients from a regression of the outcome variable on a dummy variable for the corresponding category and a constant. Hence we separately examine whether each individual type above has a different likelihood of paying compared to all other individuals (i.e. all those not in the specified type)."	///
					"In addition, we also test for whether there is a difference in the likelihood of paying for enrolment between those who enrolled at a camp and those who did not. We find that in the sample combining all three states, enrolling at a camp is associated with a lower likelihood of paying for enrolment. (We discuss this result on p6 of the State of Aadhaar Report 2017-18.)") ///
					`option'
					
				eststo clear	
				
				
			* By state
			
				tokenize `" "Andhra Pradesh" "Rajasthan" "West Bengal" "'
				loc option append
				forv i = 1/3{
					eststo clear
					local regressors `" "sc_cat st_cat" rel_muslim resp_noschool resp_female resp_above60 aadhaar_camp"' 
					local j = 1
					foreach var in `regressors'{
						qui svy: regress ad_pay `var' if state == `i'
						gen sample = e(sample)
						count if (ad_pay ==.d | ad_pay ==.r) & state == `i'
						loc miss = r(N)
						count if (ad_pay ==.e) & state == `i'
						loc errors = r(N)
						
						preserve
						keep if sample == 1
						svy: mean `var'
						if `j++'==1{
							loc x1 = _b[sc_cat] 
							loc x2 = _b[st_cat]
						}
						else{
							loc x1 = _b[`var']
							loc x2 = .
						}
						svy: mean ad_pay
						loc y1 = _b[ad_pay]
						eststo: svy: regress ad_pay `var'
						estadd scalar missing = `miss'
						estadd scalar errors = `errors'
						estadd scalar y = `y1'
						estadd scalar x = `x1'
						estadd scalar z = `x2'
						restore
						drop sample
					}
				local k = `i' + 1
					
				esttab using "1_Enrolment.rtf", ///
						compress ///
						eqlabels(none) ///
						label ///
						title ("Table 1.9.`k' Hypothesis tests of differences in the likelihood of paying for enrolment among respondents from different vulnerable communities, and whether respondent enrolled at a camp [State: ``i++'']") ///	
						coeflabels (sc_cat "SC respondent" st_cat "ST respondent" rel_muslim "Muslim respondent" resp_noschool  "Respondent has not attended school" resp_female "Female respondent" resp_above60 "Respondent above age 60") ///
						mtitles("Having paid for enrolment" "Having paid for enrolment" "Having paid for enrolment" "Having paid for enrolment" "Having paid for enrolment" "Having paid for enrolment" "Having paid for enrolment" "Having paid for enrolment") ///
						p ///
						star (* 0.1 ** 0.05 *** 0.01) ///
						lines ///
						b (3) ///
						p (2) ///
						nogaps ///
						stats(N r2 y, fmt(0 3 3) label("Number of observations" "R-squared" "Mean of dependent variable")) ///
						nonotes ///
						addnotes("Notes: p-values in parentheses, with ***, **, * indicating significance at 1, 5 and 10%. No correction for multiple hypothesis testing has been applied to the results in the table." ///
						"See footnote to Table 1.9.1 for a description of the hypotheses tested here.")	///
						`option'
						loc option append
				}		
				eststo clear	
			
			
		*********************************************
		** Ease of enrolment by demographics and camp **	
		*********************************************	
		
			recode ad_enease (2 = 3) (3 = 2) (4 = 1), gen (ad_enease_reg)
			tab ad_enease, gen (enrolment_ease)
		
			* Pooled
		
				loc option append
				eststo clear
				local regressors `" "sc_cat st_cat" rel_muslim resp_noschool resp_female resp_above60"'
				local j = 1
				foreach var in `regressors'{
					qui svy: regress ad_enease_reg `var' 
					gen sample = e(sample)
					count if (ad_enease_reg ==.d | ad_enease_reg ==.r) 
					loc miss = r(N)
					count if (ad_enease_reg ==.e) 
					loc errors = r(N)
					
					preserve
					keep if sample == 1
					svy: mean `var'
					if `j++'==1{
						loc x1 = _b[sc_cat] 
						loc x2 = _b[st_cat]
					}
					else{
						loc x1 = _b[`var']
						loc x2 = .
					}
					svy: mean ad_enease_reg
					loc y1 = _b[ad_enease_reg]
					eststo: svy: regress ad_enease_reg `var'
					estadd scalar missing = `miss'
					estadd scalar errors = `errors'
					estadd scalar y = `y1'
					estadd scalar x = `x1'
					estadd scalar z = `x2'
					restore
					drop sample
				}	
				esttab using "1_Enrolment.rtf", ///
					compress ///
					eqlabels(none) ///
					label ///
					title ("Table 1.10.1 Hypothesis tests of differences in perceived ease of enrolment among respondents from different vulnerable communities [All three states]") ///	
					coeflabels (sc_cat "SC respondent" st_cat "ST respondent" rel_muslim "Muslim respondent" resp_noschool  "Respondent has not attended school" resp_female "Female respondent" resp_above60 "Respondent above age 60") ///
					mtitles("Perceived ease of the enrolment process" "Perceived ease of the enrolment process" "Perceived ease of the enrolment process" "Perceived ease of the enrolment process" "Perceived ease of the enrolment process" "Perceived ease of the enrolment process" "Perceived ease of the enrolment process" "Perceived ease of the enrolment process") ///
					p ///
					star (* 0.1 ** 0.05 *** 0.01) ///
					lines ///
					b (3) ///
					p (2) ///
					nogaps ///
					stats(N r2 y, fmt(0 3 3) label("Number of observations" "R-squared" "Mean of dependent variable")) ///
					nonotes ///
					addnotes("Notes: p-values in parentheses, with ***, **, * indicating significance at 1, 5 and 10%. No correction for multiple hypothesis testing has been applied to the results in the table." ///
					"We test the null hypotheses that there are no differences in the perceived ease of enrolment between vulnerable respondents and other respondents, with vulnerability being proxied by each of the categories above. Each column presents coefficients from a regression of the outcome variable on a dummy variable for the corresponding category and a constant. Hence we separately examine whether each individual type above has different perceived ease compared to all other individuals (i.e. all those not in the specified type).") ///
					`option'
						
			* By state
		
				tokenize `" "Andhra Pradesh" "Rajasthan" "West Bengal" "'
				loc option append
				forv i = 1/3{
					eststo clear
					local regressors `" "sc_cat st_cat" rel_muslim resp_noschool resp_female resp_above60"'
					local j = 1
					foreach var in `regressors'{
						qui svy: regress ad_enease_reg `var' if state == `i'
						gen sample = e(sample)
						count if (ad_enease_reg ==.d | ad_enease_reg ==.r) & state == `i'
						loc miss = r(N)
						count if (ad_enease_reg ==.e) & state == `i'
						loc errors = r(N)
						
						preserve
						keep if sample == 1
						svy: mean `var'
						if `j++'==1{
							loc x1 = _b[sc_cat] 
							loc x2 = _b[st_cat]
						}
						else{
							loc x1 = _b[`var']
							loc x2 = .
						}
						svy: mean ad_enease_reg
						loc y1 = _b[ad_enease_reg]
						eststo: svy: regress ad_enease_reg `var'
						estadd scalar missing = `miss'
						estadd scalar errors = `errors'
						estadd scalar y = `y1'
						estadd scalar x = `x1'
						estadd scalar z = `x2'
						restore
						drop sample
					}
					local k = `i' + 1
					esttab using "1_Enrolment.rtf", ///
						compress ///
						eqlabels(none) ///
						label ///
						title ("Table 1.10.`k' Hypothesis tests of differences in perceived ease of enrolment among respondents from different vulnerable communities [State: ``i++'']") ///	
						coeflabels (sc_cat "SC respondent" st_cat "ST respondent" rel_muslim "Muslim respondent" resp_noschool  "Respondent has not attended school" resp_female "Female respondent" resp_above60 "Respondent above age 60") ///
						mtitles("Perceived ease of the enrolment process" "Perceived ease of the enrolment process" "Perceived ease of the enrolment process" "Perceived ease of the enrolment process" "Perceived ease of the enrolment process" "Perceived ease of the enrolment process" "Perceived ease of the enrolment process" "Perceived ease of the enrolment process") ///
						p ///
						star (* 0.1 ** 0.05 *** 0.01) ///
						lines ///
						b (3) ///
						p (2) ///
						nogaps ///
						stats(N r2 y, fmt(0 3 3) label("Number of observations" "R-squared" "Mean of dependent variable")) ///
						nonotes ///
						addnotes("Notes: p-values in parentheses, with ***, **, * indicating significance at 1, 5 and 10%. No correction for multiple hypothesis testing has been applied to the results in the table." ///
						"See footnote to Table 1.10.1 for a description of the hypotheses tested here.")	///
						`option'
						loc option append
						}		
					eststo clear



/*****************************************************************************
2. Analysis using roster data
*****************************************************************************/

	*** Survey set up

		cd "${dir}/Data_sets/"
		use "SOA2018_roster_cleaned_gen.dta", clear

		rename master_key hh_id 
		svyset district_id [pweight=weight_hh_adj] || AC_id || ps_id || hh_id || _n
		cd "${dir}/Output_tables/"
		

	***  Tabulations / Proportions / Means
		
		*****************************************************************************
		* 1 Does the family member have an Aadhaar card?
		* Types of analysis: Proportion ad_pay 
		*****************************************************************************
		
			eststo: estpost svy: tab aadhaar_fm, percent nototal ci
			estadd matrix cil = e(lb)
			estadd matrix ciu = e(ub)
			count if (aadhaar_fm ==.d | aadhaar_fm ==.r)
			estadd scalar missing  = r(N)
			count if (aadhaar_fm ==.e) 
			estadd scalar er  = r(N)
				forvalues i = 1/3 {
			display `i' 
			eststo: estpost svy: tab aadhaar_fm if state == `i', percent nototal ci
			estadd matrix cil = e(lb)
			estadd matrix ciu = e(ub)
			count if (aadhaar_fm ==.d | aadhaar_fm ==.r) & state == `i'
			estadd scalar missing  = r(N)
			count if (aadhaar_fm ==.e) & state == `i'
			estadd scalar er  = r(N)
				}

			esttab using "1_Enrolment.rtf", ///
			compress ///
			collabels(none) ///
			eqlabels(none) ///
			label ///
			modelwidth(0) ///
			incelldelimiter(-) ///
			cells(b(fmt(1)) "cil & ciu") ///
			title ("Table 1.11 Percentage of residents who have an Aadhaar (among all households surveyed)") ///	
			nostar ///
			nonumbers ///
			mtitles ("All three states" "Andhra Pradesh" "Rajasthan" "West Bengal") ///
			nogaps ///
			stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know / refused)" "Number of observations with survey errors (hence missing)")) ///
			nonotes ///
			addnotes("Notes: 95% confidence intervals are under point estimates." "This question was asked about all household members of the main respondent.") ///
			append 
			
			eststo clear
		
		*****************************************************************************
		* 2 If no Aadhaar: did the family member try to get an Aadhaar card?
		* Types of analysis: Proportion ad_pay 
		*****************************************************************************
		
			
			eststo: estpost svy: tab noaadhaar_try, percent nototal ci
			estadd matrix cil = e(lb)
			estadd matrix ciu = e(ub)
			count if (noaadhaar_try ==.d | noaadhaar_try ==.r)
			estadd scalar missing  = r(N)
			count if (noaadhaar_try ==.e) 
			estadd scalar er  = r(N)
				forvalues i = 1/3 {
			display `i' 
			eststo: estpost svy: tab noaadhaar_try if state == `i', percent nototal ci
			estadd matrix cil = e(lb)
			estadd matrix ciu = e(ub)
			count if (noaadhaar_try ==.d | noaadhaar_try ==.r) & state == `i'
			estadd scalar missing  = r(N)
			count if (noaadhaar_try ==.e) & state == `i'
			estadd scalar er  = r(N)
				}

			esttab using "1_Enrolment.rtf", ///
			compress ///
			collabels(none) ///
			eqlabels(none) ///
			coeflabels ( 0 "No" 1 "Yes, but was not able to get an Aadhaar" 2 "Yes, has enrolled for it but have not received it" 100 "I tried for my child but was told that they were too young") ///
			label ///
			modelwidth(0) ///
			incelldelimiter(-) ///
			cells(b(fmt(1)) "cil & ciu") ///
			title ("Table 1.12 Percentage of residents who tried to enrol for Aadhaar (among all residents who do not have an Aadhaar)") ///	
			nostar ///
			nonumbers ///
			mtitles ("All three states" "Andhra Pradesh" "Rajasthan" "West Bengal") ///
			nogaps ///
			stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know / refused)" "Number of observations with survey errors (hence missing)")) ///
			nonotes ///
			addnotes("Notes: 95% confidence intervals are under point estimates." "This question was asked about all household members of the main respondent.") ///
			append 
			
			eststo clear	
	
	
	***  Regressions / Hypothesis tests
	
	
		*********************************************
		** Enrolment by demographics **	
		*********************************************	
		
		* Pooled
		
		loc option append
			eststo clear
			local regressors `" "sc_cat st_cat" rel_muslim female_member member_noschool member_above60"'
			local j = 1
			foreach var in `regressors'{
				qui svy: regress aadhaar_fm `var'
				gen sample = e(sample)
				count if (aadhaar_fm ==.d | aadhaar_fm ==.r) & !missing(age) 
				loc miss = r(N)
				count if (aadhaar_fm ==.e) & !missing(age)
				loc errors = r(N)
				
				preserve
				keep if sample == 1
				svy: mean `var'
				if `j++'==1{
					loc x1 = _b[sc_cat] 
					loc x2 = _b[st_cat]
				}
				else{
					loc x1 = _b[`var']
					loc x2 = .
				}
				svy: mean aadhaar_fm
				loc y1 = _b[aadhaar_fm]
				eststo: svy: regress aadhaar_fm `var'
				estadd scalar missing = `miss'
				estadd scalar errors = `errors'
				estadd scalar y = `y1'
				estadd scalar x = `x1'
				estadd scalar z = `x2'
				restore
				drop sample
			}
		esttab using "1_Enrolment.rtf", ///
				compress ///
				eqlabels(none) ///
				label ///
				title ("Table 1.13.1 Hypothesis tests of differences in enrolment status among members of different vulnerable communities [All three states]") ///	
				coeflabels (sc_cat "SC household member" st_cat "ST household member" female_member "Female household member" rel_muslim "Muslim household member" member_noschool "(Adult) household member has not attended school" member_above60 "(Adult) household member above age 60") ///
				mtitles ("Household member has an Aadhaar" "Household member has an Aadhaar" "Household member has an Aadhaar" "Household member has an Aadhaar" "Household member has an Aadhaar" "Household member has an Aadhaar" "(Adult) household member has an Aadhaar" "(Adult) household member has an Aadhaar") ///
				p ///
				star (* 0.1 ** 0.05 *** 0.01) ///
				lines ///
				b (3) ///
				p (2) ///
				nogaps ///
				stats(N r2 y, fmt(0 3 3) label("Number of observations" "R-squared" "Mean of dependent variable")) ///
				nonotes ///
				addnotes("Notes: p-values in parentheses, with ***, **, * indicating significance at 1, 5 and 10%. No correction for multiple hypothesis testing has been applied to the results in the table." ///
				"We test the null hypotheses that there are no differences in Aadhaar enrolment rate between vulnerable residents and other residents, with vulnerability being proxied by each of the categories above. Each column presents coefficients from a regression of the outcome variable on a dummy variable for the corresponding category and a constant. Hence we separately examine whether each individual type above has a different likelihood of having an Aadhaar compared to all other individuals (i.e. all those not in the specified type)."	///
				"This question was asked about all household members of the main respondent. In all columns the sample consists of all household members, except the last two columns of hypothesis tests regarding household members of different schooling or age groups, where we restrict to adult household members. For the last two hypotheses, the results are significant at 5% though insignificant after Bonferroni correction (which is applied to all hypothesis tests included in the report), and the magnitudes of the coefficients (0.9% and 1.6%) are very small relative to a baseline enrolment rate of 98.6% among adults. Hence we conclude that there is no systematic exclusion of Aadhaar against vulnerable groups. (We discuss this result on p5 of the State of Aadhaar Report 2017-18.)") ///
				`option'
				loc option append		
		eststo clear
		
		
		* By state
			
		tokenize `" "Andhra Pradesh" "Rajasthan" "West Bengal" "'
		loc option append
		forv i = 1/3{
			eststo clear
			local regressors `" "sc_cat st_cat" rel_muslim female_member member_noschool member_above60"'
			local j = 1
			foreach var in `regressors'{
				qui svy: regress aadhaar_fm `var' if state == `i'
				gen sample = e(sample)
				count if (aadhaar_fm ==.d | aadhaar_fm ==.r) & state == `i'
				loc miss = r(N)
				count if (aadhaar_fm ==.e) & state == `i'
				loc errors = r(N)
				
				preserve
				keep if sample == 1
				svy: mean `var'
				if `j++'==1{
					loc x1 = _b[sc_cat] 
					loc x2 = _b[st_cat]
				}
				else{
					loc x1 = _b[`var']
					loc x2 = .
				}
				svy: mean aadhaar_fm
				loc y1 = _b[aadhaar_fm]
				eststo: svy: regress aadhaar_fm `var'
				estadd scalar missing = `miss'
				estadd scalar errors = `errors'
				estadd scalar y = `y1'
				estadd scalar x = `x1'
				estadd scalar z = `x2'
				restore
				drop sample
			}
			local k = `i' + 1
			
		esttab using "1_Enrolment.rtf", ///
				compress ///
				eqlabels(none) ///
				label ///
				title ("Table 1.13.`k' Hypothesis tests of differences in enrolment status among members of different vulnerable communities [State: ``i++'']") ///	
				coeflabels (sc_cat "SC household member" st_cat "ST household member" female_member "Female household member" rel_muslim "Muslim household member" member_noschool "(Adult) household member has not attended school" member_above60 "(Adult) household member above age 60") ///
				mtitles ("Household member has an Aadhaar" "Household member has an Aadhaar" "Household member has an Aadhaar" "Household member has an Aadhaar" "Household member has an Aadhaar" "Household member has an Aadhaar" "(Adult) household member has an Aadhaar" "(Adult) household member has an Aadhaar") ///
				p ///
				star (* 0.1 ** 0.05 *** 0.01) ///
				lines ///
				b (3) ///
				p (2) ///
				nogaps ///
				stats(N r2 y, fmt(0 3 3) label("Number of observations" "R-squared" "Mean of dependent variable")) ///
				nonotes ///
				addnotes("Notes: p-values in parentheses, with ***, **, * indicating significance at 1, 5 and 10%. No correction for multiple hypothesis testing has been applied to the results in the table." ///
				"See footnote to Table 1.13.1 for a description of the hypotheses tested here.")	///
				`option'
				loc option append
		}		
		eststo clear


	***  Additional analysis

		*****************************************************************************
		* Percentage of people rejected *
		*****************************************************************************		
				
			replace noaadhaar_try = 3 if aadhaar_fm == 1
			replace noaadhaar_try = .d if aadhaar_fm == .d
			replace noaadhaar_try = .r if aadhaar_fm == .r
			label define noaadhaar_try1 0 "Did not try" 1 "Tried but was rejected" 2 "Enrolled but have not received it yet" 3 "Enrolled"
			label values noaadhaar_try noaadhaar_try1	
			
			recast int noaadhaar_try
				
			eststo clear
			eststo: estpost svy: tab noaadhaar_try, percent nototal ci
			
			count if (noaadhaar_try ==.d | noaadhaar_try ==.r)
			estadd scalar missing  = r(N)
			
			esttab using "1_Enrolment.rtf", ///
				compress ///
				eqlabels(none) ///
				coeflabels (0 "Did not try to enrol" 1 "Tried but was not successful" 2 "Enrolled but have not received it yet" 3 "Has Aadhaar") ///
				label ///
				ci ///
				title ("Table 1.14 Aadhaar enrolment status of residents (numbers in percentage)") ///	
				nostar ///
				nonumbers ///
				b(3) ///
				mtitles ("All three states") ///
				nogaps ///
				stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know/refused)")) ///
				nonotes ///
				addnotes("Notes: 95% confidence intervals are under point estimate." ///
				"This question was asked about all household members of the main respondent.") ///
				append	
				
				
		*****************************************************************************
		* Reasons for rejection *
		*****************************************************************************
			
			eststo clear
			eststo: estpost svy: tab noaadhaar_why, percent nototal ci
			count if (noaadhaar_why ==.d | noaadhaar_why ==.r) 
			estadd scalar missing  = r(N)
			
			esttab using "1_Enrolment.rtf", ///
				compress ///
				eqlabels(none) ///
				coeflabels (1 "Biometric errors" 2 "I did not know where to enrol" 3 "There are no enrolment centers" 6 "I was not from the village" 7 "Due to my disability" 9 "I did not have the necessary documents" 21 "The enrolment center was closed" 22 "I was denied at the enrolment center" 24 "Due to my age" 25 "Irregular behavior from enrolment" 100 "Told child was too young" 101 "Machine was not working") ///
				label ///
				ci ///
				title ("Table 1.15.1 Reasons for unsuccessful enrolment in Aadhaar (numbers in percentage) [All three states]") ///	
				nostar ///
				nonumbers ///
				b(3) ///
				mtitles ("All three states") ///
				nogaps ///
				stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know/refused)")) ///
				nonotes ///
				addnotes("Notes: 95% confidence intervals are under point estimate.") ///
				append	
			
			eststo clear
			eststo: estpost svy: tab noaadhaar_why if state == 1, percent nototal ci
			count if (noaadhaar_why ==.d | noaadhaar_why ==.r) & state == 1
			estadd scalar missing  = r(N)
			
			esttab using "1_Enrolment.rtf", ///
				compress ///
				eqlabels(none) ///
				coeflabels (1 "Biometric errors" 2 "I did not know where to enrol" 3 "There are no enrolment centers" 6 "I was not from the village" 7 "Due to my disability" 9 "I did not have the necessary documents" 21 "The enrolment center was closed" 22 "I was denied at the enrolment center" 24 "Due to my age" 25 "Irregular behavior from enrolment" 100 "Told child was too young" 101 "Machine was not working") ///
				label ///
				ci ///
				title ("Table 1.15.2 Reasons for unsuccessful enrolment in Aadhaar (numbers in percentage) [State: Andhra Pradesh]") ///	
				nostar ///
				nonumbers ///
				b(3) ///
				mtitles ("Andhra Pradesh") ///
				nogaps ///
				stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know/refused)")) ///
				nonotes ///
				addnotes("Notes: 95% confidence intervals are under point estimate.") ///
				append	
			
			eststo clear
			eststo: estpost svy: tab noaadhaar_why if state == 2, percent nototal ci
			count if (noaadhaar_why ==.d | noaadhaar_why ==.r) & state == 2
			estadd scalar missing  = r(N)
			
			esttab using "1_Enrolment.rtf", ///
				compress ///
				eqlabels(none) ///
				coeflabels (1 "Biometric errors" 2 "I did not know where to enrol" 3 "There are no enrolment centers" 6 "I was not from the village" 7 "Due to my disability" 9 "I did not have the necessary documents" 21 "The enrolment center was closed" 22 "I was denied at the enrolment center" 24 "Due to my age" 25 "Irregular behavior from enrolment" 100 "Told child was too young" 101 "Machine was not working") ///
				label ///
				ci ///
				title ("Table 1.15.3 Reasons for unsuccessful enrolment in Aadhaar (numbers in percentage) [State: Rajasthan]") ///	
				nostar ///
				nonumbers ///
				b(3) ///
				mtitles ("Rajasthan") ///
				nogaps ///
				stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know/refused)")) ///
				nonotes ///
				addnotes("Notes: 95% confidence intervals are under point estimate.") ///
				append	
			
			eststo clear
			eststo: estpost svy: tab noaadhaar_why if state == 3, percent nototal ci
			count if (noaadhaar_why ==.d | noaadhaar_why ==.r) & state == 3
			estadd scalar missing  = r(N)
			
			esttab using "1_Enrolment.rtf", ///
				compress ///
				eqlabels(none) ///
				coeflabels (1 "Biometric errors" 2 "I did not know where to enrol" 3 "There are no enrolment centers" 6 "I was not from the village" 7 "Due to my disability" 9 "I did not have the necessary documents" 21 "The enrolment center was closed" 22 "I was denied at the enrolment center" 24 "Due to my age" 25 "Irregular behavior from enrolment" 100 "Told child was too young" 101 "Machine was not working") ///
				label ///
				ci ///
				title ("Table 1.15.4 Reasons for unsuccessful enrolment in Aadhaar (numbers in percentage) [State: West Bengal]") ///	
				nostar ///
				nonumbers ///
				b(3) ///
				mtitles ("West Bengal") ///
				nogaps ///
				stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know/refused)")) ///
				nonotes ///
				addnotes("Notes: 95% confidence intervals are under point estimate.") ///
				append	
				
				eststo clear	
					
				
		*****************************************************************************
		* Adults with Aadhaar *
		*****************************************************************************
				
			gen aadhaar_fm_adult = aadhaar_fm if age >= 18 & !missing(age)
			
			eststo clear
			eststo: estpost svy: tab aadhaar_fm_adult, percent nototal ci
			estadd matrix cil = e(lb)
			estadd matrix ciu = e(ub)
			count if (aadhaar_fm_adult ==.d | aadhaar_fm_adult ==.r)
			estadd scalar missing  = r(N)
			count if (aadhaar_fm_adult ==.e) 
			estadd scalar er  = r(N)
				forvalues i = 1/3 {
			display `i' 
			eststo: estpost svy: tab aadhaar_fm_adult if state == `i', percent nototal ci
			estadd matrix cil = e(lb)
			estadd matrix ciu = e(ub)
			count if (aadhaar_fm_adult ==.d | aadhaar_fm_adult ==.r) & state == `i'
			estadd scalar missing  = r(N)
			count if (aadhaar_fm_adult ==.e) & state == `i'
			estadd scalar er  = r(N)
				}

			esttab using "1_Enrolment.rtf", ///
			compress ///
			collabels(none) ///
			eqlabels(none) ///
			coeflabels (0 "No" 1 "Yes")	///
			label ///
			modelwidth(0) ///
			incelldelimiter(-) ///
			cells(b(fmt(1)) "cil & ciu") ///
			title ("Table 1.16 Percentage of adult residents who have an Aadhaar (among all households surveyed)") ///	
			nostar ///
			nonumbers ///
			mtitles ("All three states" "Andhra Pradesh" "Rajasthan" "West Bengal") ///
			nogaps ///
			stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know / refused)" "Number of observations with survey errors (hence missing)")) ///
			nonotes ///
			addnotes("Notes: 95% confidence intervals are under point estimates." "This question was asked about all household members of the main respondent. We restrict the sample of this analysis to adults.") ///
			append 
			
			eststo clear	
			
									
		*****************************************************************************
		* Voter ID card *
		*****************************************************************************
		
			gen voterid_table = voteridcard
			replace voterid_table = 0 if voterid_table == 2
			replace voterid_table = . if voterid_table == 9999
			
			eststo clear
			eststo: estpost svy: tab voterid_table if age >= 18 & !missing(age), percent nototal ci
				estadd matrix cil = e(lb)
				estadd matrix ciu = e(ub)
				count if (voterid_table ==.d | voterid_table ==.r) & age >= 18 & !missing(age)
				estadd scalar missing  = r(N)
				count if (voterid_table ==.e) & age >= 18 & !missing(age)
				estadd scalar er  = r(N)
					forvalues i = 1/3 {
				display `i' 
				eststo: estpost svy: tab voterid_table if state == `i' & age >= 18 & !missing(age), percent nototal ci
				estadd matrix cil = e(lb)
				estadd matrix ciu = e(ub)
				count if (voterid_table ==.d | voterid_table ==.r) & state == `i' & age >= 18 & !missing(age)
				estadd scalar missing  = r(N)
				count if (voterid_table ==.e) & state == `i' & age >= 18 & !missing(age)
				estadd scalar er  = r(N)
					}

			esttab using "1_Enrolment.rtf", ///
				compress ///
				collabels(none) ///
				eqlabels(none) ///
				coeflabels ( 0 "No" 1 "Yes") ///
				label ///
				modelwidth(0) ///
				incelldelimiter(-) ///
				cells(b(fmt(1)) "cil & ciu") ///
				title ("Table 1.17: Percentage of adult residents who have Voter ID (among all households surveyed)") ///	
				nostar ///
				nonumbers ///
				mtitles ("All three states" "Andhra Pradesh" "Rajasthan" "West Bengal") ///
				nogaps ///
				stats(N missing, fmt(0) label("Number of observations" "Number of missing observations (don't know / refused)" "Number of observations with survey errors (hence missing)")) ///
				nonotes ///
				addnotes("Notes: 95% confidence intervals are under point estimates." "This question was asked about all household members of the main respondent. We restrict the sample of this analysis to adults.") ///
				append 
				
				eststo clear	
